package com.tj.bo.trade.client.enums;

/**
 * @program: binary-option
 * @description
 * @author: binary
 * @create: 2020-06-11 10:24
 **/
public enum CoinTypeEnum {
    INR(0,"INR"),
    CNY(1, "CNY"),
    USD(2, "USD");

    CoinTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    private Integer code;
    private String name;

    public Integer getCode() {
        return code;
    }

    public CoinTypeEnum setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getName() {
        return name;
    }

    public CoinTypeEnum setName(String name) {
        this.name = name;
        return this;
    }

    public static CoinTypeEnum getEnumByCode(Integer code){
        CoinTypeEnum coinTypeEnum = null;
        if(code != null){
            for(CoinTypeEnum typeEnum : CoinTypeEnum.values()){
                if(code == typeEnum.getCode()){
                    coinTypeEnum = typeEnum;
                    break;
                }
            }
        }
        return coinTypeEnum;
    }
}
